<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=8">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta content="B2B电商平台" name="description"/>
<meta content="B2B电商平台" name="keyword"/>

<title>B2B电商平台.店铺商品类型维护</title>
<link rel="icon" href="include/images/icss.ico" type="image/x-icon" />
<link rel="shortcut icon" href="include/images/icss.ico" type="image/x-icon" />
<link rel="stylesheet" type="text/css" href="<%=path %>/include/css/global.css" />
<link rel="stylesheet" type="text/css" href="<%=path %>/include/css/proManage.css" />
<link rel="stylesheet" type="text/css" href="<%=path %>/include/css/style.css" />
<link rel="stylesheet" type="text/css" href="<%=path%>/include/pagination/page.css" media="all">
<link rel="stylesheet" type="text/css" href="<%=path %>/include/css/mmt_trading.css" />
<script type="text/javascript" src="<%=path %>/include/js/jquery-1.8.0.min.js"></script>
<script type="text/javascript" src="<%=path %>/include/js/cookies.js"></script>
<script type="text/javascript" src="<%=path%>/include/pagination/jquery.pagination.js"></script>
<script type="text/javascript" src="<%=path%>/include/pagination/init.js"></script>
<script type="text/javascript" src="<%=path %>/include/js/icss.busin.js"></script>
<script type="text/javascript" src="<%=path %>/include/js/icss.common.js"></script>
<style type="text/css">
	.tag_x {
	    width: 30%;
	    font-size: 12px;
	    height: 28px;
	    border-bottom: 0px solid rgb(225, 0, 0);
	}
.listed_tb_k	th{
	    border:1px solid #ddd;
	}
.listed_tb_k td{
         border:1px solid #ddd;
}
button{
    width:44px;
    height:24px;
    line-height:24px;   
    background-color: transparent;
    background-repeat: no-repeat;
    background-position: 0 -203px;
    border:0;
    cursor:pointer;
    font: 12px/1.5 arial,tahoma,\5b8b\4f53;
    margin: 0 0 0 5px;
    outline:none;
    background-image: url('<%=path%>/include/css/img/xs_bgx.png');   
}
</style>
<script type="text/javascript">
	$(function(){
		_queryList();
	})
	//查询广告信息
	var pagination;
	function _queryList(){
		var url = "<%=path %>/shopVip/queryVipList.do";
  		pagination = _initPagination({'pageId':'pagination', 'cKey':'toAdInfo','url': url,'rows': 8, 'callback':_initDataList});
  		
	}
	function _initDataList(data) {
	 		var d = data.rows;
	 		var total = data.total;
	 		$("#total").val(total);
			var str = "";
			$("#vipList").empty();
			for(var i=0;i<d.length;i++){
				str += "<tr>";
				str += "    <td class='t1' style='text-align:center;vertical-align: middle'>"+d[i].GROUP_NAME+"</td>";
				str += "    <td class='t1' style='text-align:center;vertical-align: middle'>"+d[i].BEG_MONEY+"&nbsp;~&nbsp;"+d[i].END_MONEY+"</td>";
				str += "    <td class='t1' style='text-align:center;vertical-align: middle'>"+d[i].BEG_NUM+"&nbsp;~&nbsp;"+d[i].END_NUM+"</td>";
				str += "    <td class='t1' style='text-align:center;vertical-align: middle'>"+d[i].SORT_NUM+"</td>";
				str += "    <td class='t1' style='text-align:center;vertical-align: middle'>"+d[i].DISCOUNT+"</td>";
				if(d[i].USE_VIP==0){
					str += "    <td class='t1' style='text-align:center;vertical-align: middle;color:#CD0000;'>停用</td>";
				} else if(d[i].USE_VIP==1){
					str += "    <td class='t1' style='text-align:center;vertical-align: middle'>启用</td>";
				}
				str +=" 	<td class='t6' style='text-align:center;vertical-align: middle' class='t1'>";
				if(d[i].USE_VIP==0){
					str +="      		<a href='javaScript:void(0);'  onclick=\"_start('" + d[i].UUID +"','" + d[i].USE_VIP +"')\" >启用</a>";
					str +="    		/&nbsp;<a href='javaScript:void(0);' onclick=\"editShopVip('" + d[i].UUID +"')\" >编辑</a></p>";
				}else if(d[i].USE_VIP==1){
					str +="      		<a href='javaScript:void(0);'  onclick=\"_stop('" + d[i].UUID +"','" + d[i].USE_VIP +"')\" >停用</a>";
				}
				str +=" 	</td>";
				str +=" </tr>";
			}
			$("#vipList").append(str);
			
	 }



	//添加广告信息
	function addShopVip(){
		var url = "<%=path%>/shopVip/toEditShopVip.do?act=add&total="+$("#total").val();
		window.location.href=url;
	}

	//编辑广告信息
	function editShopVip(uuid){
		var url = "<%=path%>/shopVip/toEditShopVip.do?act=edit&uuid="+uuid+"&total="+$("#total").val();
		window.location.href=url;
	}


	//启用操作
		function _start(id,status){
			 parent.swal({
                  title: "启用操作",
                  text: "确认启用吗？",
                  type: "info",
                  showConfirmButton:true,  
                  showCancelButton: true,
                  closeOnConfirm: true,
                  cancelButtonText: "取消",
				  confirmButtonText: "确认",
				  confirmButtonColor: "#ec6c62",
                  animation: "slide-from-top",
              }, function(inputValue) {
                  	if(inputValue){
						$.ajax({
			                cache: true,
			                type: "POST",
			                url:'<%=path%>/shopVip/start.do',
			                data:{
			                	id : id,
			                	status:status
			                },
			                async: false,
			                error: function(request) {
			                  parent.swal("服务器拒绝访问!");
			                },
			                success: function(data) {
			                	data = eval('(' + data + ')');
								var msg = data.msg;
			                    if(data.success){
				                    _queryList();
								}else {
									parent.swal(msg);
								}
			                }
			           	});
           		}
           	});
		}
		//停用操作	
		function _stop(id,status){
			 parent.swal({
                  title: "停用操作",
                  text: "确认停用吗？",
                  type: "info",
                  showConfirmButton:true,  
                  showCancelButton: true,
                  closeOnConfirm: true,
                  cancelButtonText: "取消",
				  confirmButtonText: "确认",
				  confirmButtonColor: "#ec6c62",
                  animation: "slide-from-top",
              }, function(inputValue) {
                  	if(inputValue){
                  		$.ajax({
		                cache: true,
		                type: "POST",
		                url:'<%=path%>/shopVip/stop.do',
		                data:{
		                	id : id,
		                	status:status
		                },
		                async: false,
		                error: function(request) {
		                  parent.swal("服务器拒绝访问!");
		                },
		                success: function(data) {
		                	data = eval('(' + data + ')');
							var msg = data.msg;
		                    if(data.success){
			                    _queryList();
							}else {
								parent.swal(msg);
							}
		                }
		           	});
                  	}
                });
		}
		function _reHeight() {
			var main = $(window.parent.document).find("#rightFrame");
			var mainheight = $("#contentDiv").height() + 40;
			main.height(mainheight);
		}

</script>
</head>
<body style="font-family: '微软雅黑';padding: 0px;">
	<div id="contentDiv" style="padding:5px; width:99%;">
 	<div style="width:100%;height:30px;border-bottom:1px solid #ADADAD;">
      	<div class="toptil">会员管理 
	      	<div style="float:right;margin-right:10%;padding-top:0.5%" class="tag_x">
	           <em class="create" id="create"  onclick="addShopVip()" >添加</em>
	     	</div>
     	</div>
    </div>
    <div class="colnums-2-ab-b">
    <input type="hidden" name="total" id="total"/>
    	<!-- 表格部分开始 -->
		<div class="listed_tb_k" style="border:none;width: 100%;">
	        <table cellspacing="0" cellpadding="0">
	            <thead>
		            <tr>
		                <th style="text-align:center;vertical-align: middle" >VIP分组名称</th>
		                <th style="text-align:center;vertical-align: middle" >消费金额区间</th>
		                <th style="text-align:center;vertical-align: middle" >消费次数区间</th>
		                <th style="text-align:center;vertical-align: middle" >等级排序</th>
		                <th style="text-align:center;vertical-align: middle" >折扣</th>
		                <th style="text-align:center;vertical-align: middle" >状态</th>
		                <th style="text-align:center;vertical-align: middle" >操作</th>
		            </tr>
	            </thead>
	            <tbody id="vipList">
	            
				</tbody>
		    </table>
		    <br/>
			<div class="dataTables_paginate paging_full_numbers">
			</div>
			<div id="pagination" ></div>
	 	</div>
	 	<!-- 表格部分结束 -->
	 	<div class="clear"></div>
   </div>
   <div class="clear"></div>
</div>
</body>
</html>
